package com.yunhe.dao;

import java.util.List;

import org.apache.ibatis.session.SqlSession;

import com.yunhe.entity.Category;
import com.yunhe.util.MyBatisUtil;

public class CategoryImpl implements ICategory {

	SqlSession ss = MyBatisUtil.getSession();
	@Override
	public int addCategory(Category category) {
		int count = ss.insert("com.yunhe.dao.ICategory.addCategory", category);
		ss.commit();
		ss.close();
		return count;
	}

	@Override
	public List<Category> getAllCategory() {
		List<Category> list = ss.selectList("com.yunhe.dao.ICategory.getAllCategory");
		ss.close();
		return list;
	}

	@Override
	public int delCategory(Category category) {
		int count = ss.delete("com.yunhe.dao.ICategory.delCategory", category);
		ss.commit();
		ss.close();
		return count;
	}
	
}
